/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.persistencia.domain;

import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author kenny
 */
@Entity
@Table(name = "salonxperiodo")
@NamedQueries({
    @NamedQuery(name = "Salonxperiodo.findAll", query = "SELECT s FROM Salonxperiodo s"),
    @NamedQuery(name = "Salonxperiodo.findByNSlnId", query = "SELECT s FROM Salonxperiodo s WHERE s.salonxperiodoPK.nSlnId = :nSlnId"),
    @NamedQuery(name = "Salonxperiodo.findByNPrdId", query = "SELECT s FROM Salonxperiodo s WHERE s.salonxperiodoPK.nPrdId = :nPrdId"),
    @NamedQuery(name = "Salonxperiodo.findByVEstado", query = "SELECT s FROM Salonxperiodo s WHERE s.vEstado = :vEstado")})
public class Salonxperiodo implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SalonxperiodoPK salonxperiodoPK;
    @Column(name = "vEstado")
    private String vEstado;
    @JoinColumn(name = "nSlnId", referencedColumnName = "nSlnId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Salon salon;
    @JoinColumn(name = "nPrdId", referencedColumnName = "nPrdId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Periodo periodo;

    public Salonxperiodo() {
    }

    public Salonxperiodo(SalonxperiodoPK salonxperiodoPK) {
        this.salonxperiodoPK = salonxperiodoPK;
    }

    public Salonxperiodo(int nSlnId, int nPrdId) {
        this.salonxperiodoPK = new SalonxperiodoPK(nSlnId, nPrdId);
    }

    public SalonxperiodoPK getSalonxperiodoPK() {
        return salonxperiodoPK;
    }

    public void setSalonxperiodoPK(SalonxperiodoPK salonxperiodoPK) {
        this.salonxperiodoPK = salonxperiodoPK;
    }

    public String getVEstado() {
        return vEstado;
    }

    public void setVEstado(String vEstado) {
        this.vEstado = vEstado;
    }

    public Salon getSalon() {
        return salon;
    }

    public void setSalon(Salon salon) {
        this.salon = salon;
    }

    public Periodo getPeriodo() {
        return periodo;
    }

    public void setPeriodo(Periodo periodo) {
        this.periodo = periodo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (salonxperiodoPK != null ? salonxperiodoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Salonxperiodo)) {
            return false;
        }
        Salonxperiodo other = (Salonxperiodo) object;
        if ((this.salonxperiodoPK == null && other.salonxperiodoPK != null) || (this.salonxperiodoPK != null && !this.salonxperiodoPK.equals(other.salonxperiodoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.persistencia.domain.Salonxperiodo[ salonxperiodoPK=" + salonxperiodoPK + " ]";
    }
    
}
